/*
 *      Copyright (c) 2018-2028, Chill Zhuang All rights reserved.
 *
 *  Redistribution and use in source and binary forms, with or without
 *  modification, are permitted provided that the following conditions are met:
 *
 *  Redistributions of source code must retain the above copyright notice,
 *  this list of conditions and the following disclaimer.
 *  Redistributions in binary form must reproduce the above copyright
 *  notice, this list of conditions and the following disclaimer in the
 *  documentation and/or other materials provided with the distribution.
 *  Neither the name of the dreamlu.net developer nor the names of its
 *  contributors may be used to endorse or promote products derived from
 *  this software without specific prior written permission.
 *  Author: Chill 庄骞 (smallchill@163.com)
 */
package org.springblade.modules.mes.base.entity;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import com.fasterxml.jackson.databind.ser.std.NullSerializer;
import com.fasterxml.jackson.databind.ser.std.ToStringSerializer;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springblade.core.mp.base.BaseEntity;
import org.springframework.format.annotation.DateTimeFormat;

import java.util.Date;

/**
 * 生产工单实体类
 *
 * @author BladeX
 * @since 2023-04-23
 */
@Data
@TableName("prod_production_order")
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "ProductionOrder对象", description = "生产工单")
public class ProductionOrder extends BaseEntity {

	private static final long serialVersionUID = 1L;

	/**
	* 计划日期
	*/
		@DateTimeFormat(
				pattern = "yyyy-MM-dd"
		)
		@JsonFormat(
				pattern = "yyyy-MM-dd"
		)
		private Date planDate;
	/**
	* 生产线
	*/
		@ApiModelProperty(value = "生产线")
		private String productionLine;
	/**
	* 总成号
	*/
		@ApiModelProperty(value = "总成号")
		private String assemblyNo;
		@ApiModelProperty(value = "总成名称")
		private String assemblyName;
	/**
	* 配方号
	*/
		@ApiModelProperty(value = "配方号")
		private String formulaNo;
	/**
	* 班组
	*/
		@ApiModelProperty(value = "班组")
		private String classes;
	/**
	* 班制
	*/
		@ApiModelProperty(value = "班制")
		private String shift;
	/**
	* 计划数量
	*/
		@ApiModelProperty(value = "计划数量")
		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		private Integer planQuantity;
	/**
	* 计划状态 1待下发、2待生产、3生产中、4完成、5暂停、6终止、7延期关闭
	*/
		@ApiModelProperty(value = "计划状态")
		private Integer planStatus;
	/**
	* 下发时间
	*/
		@DateTimeFormat(
				pattern = "yyyy-MM-dd HH:mm:ss"
		)
		@JsonFormat(
				pattern = "yyyy-MM-dd HH:mm:ss"
		)
		@ApiModelProperty(value = "下发时间")
		private Date distributeTime;
	/**
	* 开始时间
	*/
		@DateTimeFormat(
				pattern = "yyyy-MM-dd HH:mm:ss"
		)
		@JsonFormat(
				pattern = "yyyy-MM-dd HH:mm:ss"
		)
		@ApiModelProperty(value = "开始时间")
		private Date startTime;
	/**
	* 完成时间
	*/
		@DateTimeFormat(
				pattern = "yyyy-MM-dd HH:mm:ss"
		)
		@JsonFormat(
				pattern = "yyyy-MM-dd HH:mm:ss"
		)
		@ApiModelProperty(value = "完成时间")
		private Date completeTime;
	/**
	* 顺序
	*/
		@ApiModelProperty(value = "顺序")
		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		private Integer sequence;
	/**
	* 下发数量
	*/
		@ApiModelProperty(value = "下发数量")
		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		private Integer distributeQuantity;
	/**
	* 计划类型 1准时化、2预批量、3量产
	*/
		@ApiModelProperty(value = "计划类型")
		private String planType;
		@ApiModelProperty(value = "完成数量")
		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		private Integer completeQuantity;

		@ApiModelProperty(value = "计划执行数量")
		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		private Integer executeQuantity;

		@ApiModelProperty(value = "工单类型1计划员插单2产线插单")
		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		private String orderType;

		@ApiModelProperty(value = "工单编号")
		private String orderNo;

		@ApiModelProperty(value = "异常原因")
		private String reason;

		@ApiModelProperty(value = "备注")
		private String remark;

		@JsonSerialize(
				nullsUsing = NullSerializer.class,
				using = ToStringSerializer.class
		)
		@TableField(exist = false)
		private Long nextId;
}
